package Person.Fanshe.ith_03;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

public class ReflectDemo02 {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
//获取class对象
        Class<?> c = Class.forName("Person.Fanshe.ith_01.Student");
        Constructor<?> con = c.getConstructor(String.class,int.class,String.class);
        //基本数据类型也可以通过.class得到对应的类型
        Object obj = con.newInstance("户",18,"河南");
        System.out.println(obj);
    }
}
